/* 现代化工具页面样式 */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-medium: 0 8px 25px rgba(0,0,0,0.12);
    --shadow-heavy: 0 15px 35px rgba(0,0,0,0.15);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #f093fb);
    --gradient-success: linear-gradient(135deg, #4CAF50, #45a049);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局样式重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.tools-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    position: relative;
    overflow-x: hidden;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.circle-1 {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.circle-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.circle-3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 60%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* 主容器 */
.tools-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部导航栏 */
.tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo i {
    font-size: 28px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.header-subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin: 0;
}

.header-nav {
    display: flex;
    gap: 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* 工具导航网格 */
.tool-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.tool-nav-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    box-shadow: var(--shadow-light);
    display: flex;
    align-items: center;
    gap: 15px;
}

.tool-nav-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-color);
}

.tool-nav-card.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.nav-card-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.nav-card-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.nav-card-content p {
    font-size: 13px;
    opacity: 0.8;
    margin: 0;
}

.tool-nav-card.active .nav-card-content p {
    opacity: 0.9;
}

/* 主要工具内容区域 */
.tools-main {
    position: relative;
}

.tool-section {
    display: none;
    animation: fadeInUp 0.6s ease-out;
}

.tool-section.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 区域标题 */
.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section-header p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 500px;
    margin: 0 auto;
}

/* 工具网格布局 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    max-width: none;
}

.tool-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-heavy);
}

.tool-card.full-width {
    grid-column: 1 / -1;
}

.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

/* 卡片标题 */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--gradient-primary);
    color: white;
    font-weight: bold;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

/* 卡片内容 */
.card-body {
    padding: 25px;
}

/* 表单元素 */
.form-row {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    background: white;
    color: var(--text-dark);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.5;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--gradient-accent);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.3);
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 结果显示框 */
.result-box {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    min-height: 50px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    transition: var(--transition);
}

.result-box:not(:empty) {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.result-box.success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.result-box.error {
    background: #f8d7da;
    border-color: var(--error-color);
    color: #721c24;
}

.result-box.warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

/* 特殊结果样式 */
.code-result {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

.math-result {
    font-size: 16px;
    font-weight: 600;
}

.health-result .bmi-category {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    margin-top: 10px;
}

.health-result .bmi-category.normal { background: var(--success-color); }
.health-result .bmi-category.underweight { background: var(--primary-color); }
.health-result .bmi-category.overweight { background: var(--warning-color); }
.health-result .bmi-category.obese { background: var(--error-color); }

.stats-result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
}

.weather-result .weather-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.weather-result .weather-icon {
    font-size: 2.5em;
}

/* 颜色选择器 */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.color-input {
    width: 60px !important;
    height: 60px !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer;
    box-shadow: var(--shadow-light);
}

.color-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: var(--shadow-light);
}

.color-result .color-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 密码生成器 */
.password-options {
    margin-bottom: 20px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.checkbox-label:hover {
    color: var(--primary-color);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.password-result code {
    display: block;
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    letter-spacing: 1px;
    margin: 10px 0;
    word-break: break-all;
}

/* 转换器网格 */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .tools-container {
        padding: 15px;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .tools-container {
        padding: 10px;
    }
    
    .tools-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 20px;
    }
    
    .header-nav {
        justify-content: center;
    }
    
    .tool-nav-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tool-card.full-width {
        grid-column: 1;
    }
    
    .section-header h2 {
        font-size: 28px;
    }
    
    .card-header,
    .card-body {
        padding: 20px;
    }
    
    .converter-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .tools-container {
        padding: 8px;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .tool-nav-card {
        padding: 15px;
    }
    
    .nav-card-icon {
        font-size: 28px;
    }
    
    .nav-card-content h3 {
        font-size: 16px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #e2e8f0;
        --text-light: #a0aec0;
        --bg-white: #2d3748;
        --bg-light: #4a5568;
        --border-color: #4a5568;
    }
}